package service

import (
	"context"
	v1 "devops-super/api/file/v1"
	"github.com/gogf/gf/v2/net/ghttp"
)

type (
	IFile interface {
		UploadFiles(ctx context.Context, files []*ghttp.UploadFile, checkFileType string, source int) (result v1.UploadMultipleRes, err error)
		UploadFile(ctx context.Context, file *ghttp.UploadFile, checkFileType string, source int) (result v1.UploadResponse, err error)
		UploadBase64(ctx context.Context, base64Str string, source int) (result v1.UploadResponse, err error)
		CommonUpload(ctx context.Context, req *v1.FileCommonUploadReq) (res *v1.FileCommonUploadRes, err error)
		CommonBase64Upload(ctx context.Context, base64Data string) (url string, err error)
	}
)

var (
	localFile IFile
)

func File() IFile {
	if localFile == nil {
		panic("implement not found for interface IFile, forgot register?")
	}
	return localFile
}

func RegisterFile(i IFile) {
	localFile = i
}
